// 生成从minNum到maxNum的随机数
// 有包含区间
function randomNum(minNum, maxNum) {
  switch (arguments.length) {
    case 1:
      return parseInt(Math.random() * minNum + 1, 10);
    case 2:
      return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
    default:
      return 0;
  }
}

function changeTime(time) {
  // 转化为时间戳
  let birthday = time.replace(/[^0-9]/g, '-')    // 获取生日
  let birDate = new Date(birthday).getTime() / 1000   // 转化
  return birDate
}

module.exports = {
  randomNum,
  changeTime
}